<?php
class BannerAction extends Action{
	//app端显示广告轮图
	public function showBanner(){
		$banner = M("Banner")->where("status =1")->select();
		for ($i=0;$i<count($banner);$i++){
			if($banner[$i]['image']){
				$image = D('attach')->where('attach_id='.$banner[$i]['image'])->find();
				$image_url = $image['save_path'].$image['save_name'];
				$banner[$i]['image'] = getImageUrl($image_url);
			}
		}		
		if ($banner != false){
			$value = ["code" =>"success","data"=>$banner];
			header("Content-Type: text/json");
			die(json_encode($value));
		}
	}
}